Skip to content

feat: add cache-save input for restore-only caching - #140

Merged
fengmk2 merged 4 commits into
voidzero-dev:mainfrom
naokihaba:feat/cache-save
Sep 4, 2026
Merged

feat: add cache-save input for restore-only caching#140
fengmk2 merged 4 commits into
voidzero-dev:mainfrom
naokihaba:feat/cache-save

Conversation

@naokihaba

Copy link
Copy Markdown
Collaborator

resolves #139

This PR adds a cache-save input, defaulting to true to keep existing workflows working as expected. When cache-save is set to false, setup-vp restores the cache as usual, but skips saving it at the end. It’s mainly intended for setups where all branches need to read the cache, but only trusted ones should update it.

Note that Azure Pipelines and GitLab handle cache behavior through their own platform configs, so this only affects GitHub Actions.

Copilot AI lite review requested due to automatic review settings September 4, 2026 00:50
@naokihaba naokihaba self-assigned this Sep 4, 2026
@naokihaba
naokihaba marked this pull request as draft September 4, 2026 00:50
@naokihaba
naokihaba marked this pull request as ready for review September 4, 2026 00:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A unit test assertion in src/inputs.test.ts is missing keys that getInputs() returns, which will cause the toEqual check to fail.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a new cache-save input to the GitHub Action to support “restore-only” dependency caching (restore in main phase, optionally skip saving in post phase) while keeping existing workflows working via a default of true.

Changes:

  • Introduces cache-save input wiring (Inputs.cacheSave, parsing via getBooleanInput("cache-save"), and action.yml default true).
  • Updates post action behavior to save cache only when both cache and cache-save are enabled, with an informational log when skipping.
  • Updates docs and CI workflow coverage (README + GitHub workflow matrix) and adds/updates unit tests for the new behavior.
File summaries
File Description
src/types.ts Adds cacheSave to the Inputs contract.
src/inputs.ts Parses new cache-save input into Inputs.cacheSave.
src/index.ts Gates cache saving in post phase on cacheSave (and exports runPost for testing).
src/index.test.ts Adds targeted tests for runPost cache-save gating behavior.
src/inputs.test.ts Adds coverage for parsing cache-save and updates default-input expectations.
src/version-file.test.ts Updates test fixtures to include cacheSave.
src/utils.test.ts Updates test fixtures to include cacheSave.
src/run-install.test.ts Updates test fixtures to include cacheSave.
src/install-viteplus.test.ts Updates test fixtures to include cacheSave.
src/install-sfw.test.ts Updates test fixtures to include cacheSave.
action.yml Defines the new cache-save input (default true).
README.md Documents cache-save and adds a restore-only usage example + behavior matrix.
.github/workflows/test.yml Expands cache test job to matrix over cache-save true/false.
dist/index.mjs Updates the bundled action to include cacheSave parsing and post-phase gating logic.
Review details
  • Files reviewed: 13/14 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/inputs.test.ts
@naokihaba

Copy link
Copy Markdown
Collaborator Author

@codex review

@naokihaba
naokihaba marked this pull request as draft September 4, 2026 00:54
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-04T00:56:17.604643Z d75c9e1 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@naokihaba
naokihaba marked this pull request as ready for review September 4, 2026 00:55
@naokihaba
naokihaba requested a review from fengmk2 September 4, 2026 00:55
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: d75c9e1d9b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread README.md Outdated

@fengmk2 fengmk2 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@naokihaba Good! I love this feature.

Co-authored-by: MK (fengmk2) <fengmk2@gmail.com>
Signed-off-by: NaokiHaba <59875779+naokihaba@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 4, 2026 04:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The new cache-save input is consistently implemented across inputs/types/runtime, documented, and covered by unit/CI tests without introducing breaking behavior (default remains saving enabled).

Review details
  • Files reviewed: 13/14 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@fengmk2
fengmk2 merged commit d6f71cc into voidzero-dev:main Sep 4, 2026
52 checks passed
yusuke99 added a commit to yusuke99/setup-vp that referenced this pull request Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a cache-save input to support restore-only dependency caching

3 participants